/****************************************************************************
 * Copyright (C) 2025 Chenyz. All rights reserved.
 *
 * @file    TinyOS_Event.h
 *
 * @par     dependencies
 *          - stdint.h (Standard integer types)
 *          - TinyOS_Types.h (Type definitions)
 *
 * @author  Chenyz
 *
 * @brief   Event Management Header
 *          This file provides declarations for event-based task synchronization
 *          and communication in TinyOS, including:
 *          - Event block initialization and management
 *          - Task waiting and wake-up mechanisms
 *          - Event timeout and cancellation handling
 *          - Multiple task synchronization support
 *
 * @version V1.0
 * @date    2025-10-03
 *
 * @note    This module provides the foundation for all synchronization
 *          primitives in TinyOS, enabling efficient task coordination.
 ****************************************************************************/

#ifndef __TINYOS_EVENT_H__
#define __TINYOS_EVENT_H__

/******************************** Includes **********************************/
#include <stdint.h>
#include "TinyOS_Types.h"

/*************************** Function Declarations **************************/

/* Event management functions */
void TinyOS_EventBlockInit(
    TinyOS_EventBlockType* EventBlock,   
    TinyOS_EventType EventType
);
void TinyOS_EventRemoveTask(
    TinyOS_TaskType*        Task,
    void*                   EventMsg,
    uint32_t                Result
);    
TinyOS_TaskType* TinyOS_EventWake(
    TinyOS_EventBlockType*  EventBlock,
    void*                   EventMsg,
    uint32_t                Result
);
void TinyOS_EventWakeTask(
    TinyOS_EventBlockType*  EventBlock,
    TinyOS_TaskType*        TaskHandler,
    void*                   EventMsg,
    uint32_t                Result
);    
void TinyOS_EventWait(
    TinyOS_EventBlockType*  EventBlock,
    TinyOS_TaskType*        Task,
    void*                   EventMsg,
    uint32_t                Status,
    uint32_t                TimeoutTicks
);
uint32_t TinyOS_EventRemoveAll(
    TinyOS_EventBlockType*  EventBlock,
    void*                   EventMsg,
    uint32_t                Result
);
    
uint32_t TinyOS_EventWaitCount(TinyOS_EventBlockType* EventBlock);
    
  
#endif /* __TINYOS_EVENT_H__ */

	
	
